const db = require("./index");
//data_list_co2_table: sensor_id | value | upload_time | data_unit

async function insertCo2(dataObj) {
  let sql_insert = `insert into data_list_co2 set ?`;
  return await new Promise((resolve, reject) => {
    db.query(
      sql_insert,
      {
        sensor_id: dataObj.sensor_id,
        value: dataObj.co2_data_value,
        upload_time: dataObj.upload_time,
        data_unit: dataObj.data_unit,
      },
      (err, result) => {
        if (err) {
          reject(err);
        }
        resolve(result);
      }
    );
  });
}
async function getAllData() {}
module.exports.insertCo2 = insertCo2;
module.exports.getAllData = getAllData;
